<!DOCTYPE html>
<html lang="en" class="no-js" xmlns:th="http://www.thymeleaf.org"
	xmlns:layout="http://www.ultraq.net.nz/web/thymeleaf/layout"
	layout:decorator="layout">
<head>
<title>哗啦啦</title>
</head>
<body>
	<div layout:fragment="content">
		<div class="col-md-12">
			<div class="area game">
				<div class="top1">
					<div class="col-md-3"></div>
					<div class="col-md-6">
						<div th:replace="game/gamehead"></div>
					</div>
					<div class="col-md-3"></div>
				</div>
				<div class="blank"></div>
				<div
					style="border: 1px solid #ccc; border-radius: 4px; padding: 5px;">
					<div class="top2" th:include="game/gamesubhead"></div>
					<div class="blank"></div>
					<div class="ml">  
						<div class="blank"></div>
						<div>
							<div class="ga">
        <table border="0" width="100%" cellspacing="5">
        <tr>
            <td>
                <table border="0">
                    <tr>
                        <td>标准投注模式</td>
                        <td width="40">&nbsp;</td>
                        <td>
                        	<input type="hidden" id="serverTime" th:value="${serverTime}" />
                        	<input type="hidden" id="lotteryTime" th:value="${lotteryTime}"/>
                        	<input type="hidden" id="period" th:value="${period}"/>
                        	<div class="left1" id="topTime">
                        		离第<font id="timeIssue" th:text="${period}" class="money">10147523</font>
                        		期开奖时间还有<font id="timeSec" class="money red">10</font>秒
                        	</div>
                        </td>
                    </tr>
                </table>
                </td>
            <td>我的模式</td>
        </tr>
        <tr>
            <td class="td1">
                <div>
                    <table border="0">
                        <tr>
                            <td>
                                <a href="javascript:void(0);" onclick="$.fn.ASelectAll();">全包</a>
                            </td>
                            <td>
                                <a href="javascript:void(0);" onclick="$.fn.AOddEven('odd');">单</a>
                            </td>
                            <td>
                                <a href="javascript:void(0);" onclick="$.fn.AOddEven('even');">双</a>
                            </td>
                            <td>
                                <a href="javascript:void(0);" onclick="$.fn.ABigLittle('big');">大</a>
                            </td>
                            <td>
                                <a href="javascript:void(0);" onclick="$.fn.ABigLittle('little');">小</a>
                            </td>
                            <td>
                                <a href="javascript:void(0);" onclick="$.fn.ACenSide('cen','pk10');">中</a>
                            </td>
                            <td>
                                <a href="javascript:void(0);" onclick="$.fn.ACenSide('side','pk10');">边</a>
                            </td>
                            <td>
                                <a href="javascript:void(0);" onclick="$.fn.ABigLittleOdd('big');">大单</a>
                            </td>
                            <td>
                                <a href="javascript:void(0);" onclick="$.fn.ABigLittleOdd('little');">小单</a>
                            </td>
                            <td>
                                <a href="javascript:void(0);" onclick="$.fn.ABigLittleEven('big');">大双</a>
                            </td>
                            <td>
                                <a href="javascript:void(0);" onclick="$.fn.ABigLittleEven('little');">小双</a>
                            </td>
                            <td>
                                <a href="javascript:void(0);" onclick="$.fn.ASideOddEvenBigLittle('big','pk10','biglittle');">大边</a>
                            </td>
                            <td>
                                <a href="javascript:void(0);" onclick="$.fn.ASideOddEvenBigLittle('little','pk10','biglittle');">小边</a>
                            </td>
                        </tr>
                        <tr>
                            <td>
                                <a href="javascript:void(0);" onclick="$.fn.ASideOddEvenBigLittle('odd','pk10','oddeven');">单边</a>
                            </td>
                            <td>
                                <a href="javascript:void(0);" onclick="$.fn.ASideOddEvenBigLittle('even','pk10','oddeven');">双边</a>
                            </td>
                            <td>
                                <a href="javascript:void(0);" onclick="$.fn.AEnd(0);">0尾</a>
                            </td>
                            <td>
                                <a href="javascript:void(0);" onclick="$.fn.AEnd(1);">1尾</a>
                            </td>
                            <td>
                                <a href="javascript:void(0);" onclick="$.fn.AEnd(2);">2尾</a>
                            </td>
                            <td>
                                <a href="javascript:void(0);" onclick="$.fn.AEnd(3);">3尾</a>
                            </td>
                            <td>
                                <a href="javascript:void(0);" onclick="$.fn.AEnd(4);">4尾</a>
                            </td>
                            <td>
                                <a href="javascript:void(0);" onclick="$.fn.AEnd(5);">5尾</a>
                            </td>
                            <td>
                                <a href="javascript:void(0);" onclick="$.fn.AEnd(6);">6尾</a>
                            </td>
                            <td>
                                <a href="javascript:void(0);" onclick="$.fn.AEnd(7);">7尾</a>
                            </td>
                            <td>
                                <a href="javascript:void(0);" onclick="$.fn.AEnd(8);">8尾</a>
                            </td>
                            <td>
                                <a href="javascript:void(0);" onclick="$.fn.AEnd(9);">9尾</a>
                            </td>
                            <td>
                                <a href="javascript:void(0);" onclick="$.fn.AEndBigLittle('little');">小尾</a>
                            </td>
                        </tr>
                        <tr>
                            <td>
                                <a href="javascript:void(0);" onclick="$.fn.AEndBigLittle('big');">大尾</a>
                            </td>
                            <td>
                                <a href="javascript:void(0);" onclick="$.fn.AAC(3,0);">3余0</a>
                            </td>
                            <td>
                                <a href="javascript:void(0);" onclick="$.fn.AAC(3,1);">3余1</a>
                            </td>
                            <td>
                                <a href="javascript:void(0);" onclick="$.fn.AAC(3,2);">3余2</a>
                            </td>
                            <td>
                                <a href="javascript:void(0);" onclick="$.fn.AAC(4,0);">4余0</a>
                            </td>
                            <td>
                                <a href="javascript:void(0);" onclick="$.fn.AAC(4,1);">4余1</a>
                            </td>
                            <td>
                                <a href="javascript:void(0);" onclick="$.fn.AAC(4,2);">4余2</a>
                            </td>
                            <td>
                                <a href="javascript:void(0);" onclick="$.fn.AAC(4,3);">4余3</a>
                            </td>
                            <td>
                                <a href="javascript:void(0);" onclick="$.fn.AAC(5,0);">5余0</a>
                            </td>
                            <td>
                                <a href="javascript:void(0);" onclick="$.fn.AAC(5,1);">5余1</a>
                            </td>
                            <td>
                                <a href="javascript:void(0);" onclick="$.fn.AAC(5,2);">5余2</a>
                            </td>
                            <td>
                                <a href="javascript:void(0);" onclick="$.fn.AAC(5,3);">5余3</a>
                            </td>
                            <td>
                                <a href="javascript:void(0);" onclick="$.fn.AAC(5,4);">5余4</a>
                            </td>
                        </tr>
                    </table>
                </div>
            </td>
            <td class="td2" valign="top">
                
                <div class="mymodel">
                    	<th:block th:each="model2:${models}">
                            <a th:href="@{'/fgame/'+${game.id}+'/mannualBet?modelId='+${model2.id}}+'&amp;period='+${period}" th:text="${model2.name}">2222</a>
                    	</th:block>
                        
                </div>
            </td>
        </tr>
    </table>
    
    <div class="bei" >
        <a href="javascript:void(0);" onclick="$.fn.ATimes(0.5);">0.5倍</a>
        <a href="javascript:void(0);" onclick="$.fn.ATimes(0.8);">0.8倍</a>
        <a href="javascript:void(0);" onclick="$.fn.ATimes(1.2);">1.2倍</a>
        <a href="javascript:void(0);" onclick="$.fn.ATimes(1.5);">1.5倍</a>
        <a href="javascript:void(0);" onclick="$.fn.ATimes(2);">2倍</a>
        <a href="javascript:void(0);" onclick="$.fn.ATimes(5);">5倍</a>
        <a href="javascript:void(0);" onclick="$.fn.ATimes(10);">10倍</a>
        <a href="javascript:void(0);" onclick="$.fn.ATimes(50);">50倍</a>
        <a href="javascript:void(0);" onclick="$.fn.ATimes(100);">100倍</a>
        <a href="javascript:void(0);" onclick="$.fn.AOpside();">反选</a>
        <a href="javascript:void(0);" onclick="$.fn.AClearAll();">清除</a>
        <a href="javascript:void(0);" onclick="$.fn.APutAll();">梭哈</a>
   </div>
   <div class="blank11"></div>
	<table>
    	<tr>
        	<td width="225">总投金币：<font id="ActionCountMoney" class="money money_bg" th:text="${model==null?0:model.totalBetMoney}">0</font></td>
            <td><input type="button" onclick="checkAndSubmit()"  class="acbtn" style="font-size:16px;" /></td>
        </tr>
    </table>   
    <div>
	<table id="modelTable" class="gatab table table-striped table-bordered  table-advance table-hover" cellspacing="0" style="width:100%;border-collapse:collapse;">
		<tr>
			<th>号码</th>
			<th>标准</th>
			<th>当前</th>
			<th>选择</th>
			<th>投注</th>
			<th>倍数</th>
			
		</tr>
		<tr th:each="detail:${details}">
			<td>
                <div class="xy28div2" th:classappend="${'gamebn'+detail.betNumber}" style=" float:none; margin:0 auto;"></div>
            </td>
            <td th:text="${detail.standardRate}">36</td>
            <td th:text="${detail.currentRate}">36</td>
            <td>
                <input type="hidden" id="HiddenField3_0" th:attr="id=${'hiddenField_'+detail.betNumber}" th:value="${detail.betNumber}" value="2" />
                <span class="cb2"><input th:attr="checked=${detail.betMoney != 0?'checked':'false'},id=${'checkbox_'+detail.betNumber},onclick=${'$.fn.ACheckBoxChange(this,'+detail.betNumber+')'}" type="checkbox" /></span>
            </td>
            <td class="td5">
                <input type="text" th:value="${detail.betMoney ==0?'':detail.betMoney}" th:attr="id=${'textbox_'+detail.betNumber},onblur=${'$.fn.ATextChange(this,'+detail.betNumber+')'}"/>
            </td>
            <td class="td6">
                <a href="javascript:void(0);" onclick="$.fn.ATimesOne(0.5,this);">0.5</a>
                <a href="javascript:void(0);" onclick="$.fn.ATimesOne(2,this);">2</a>
                <a href="javascript:void(0);" onclick="$.fn.ATimesOne(10,this);">10</a>
            </td>
		</tr>
	</table>
	<form style="display:none;" id="save_form" th:action="${'/fgame/'+game.id+'/savemanual'}" method="post">
		<input name="detail_json" id="detail_json"/>
		<input name="period" th:value="${period}"/>
		<input name="total_money" id="total_money" th:value="${model == null ?'0':model.totalBetMoney}"/>
	</form>
</div>
</div>
<script  th:inline="javascript">
 //新方式
  /*<![CDATA[*/
 var len = /*[[${details.size()}]]*/
            var start_len = /*[[${details.get(0).betNumber}]]*/
 			var cbids=new Array();
			var tbids=new Array();
			var anum = new Array();
			 var beg=0;
	         var end=0;
			 var numlen=anum.length;
				var rate_money = 0;
				var game_id = /*[[${game.id}]]*/
				if(game_id ==1 || game_id ==4){
					if(game_id == 1){
						beg = 10;
						end = 17;
					}else{
						beg = 3;
						end = 6;
					}
					rate_money = 1000;
				}else if(game_id ==2){
					beg = 3;
					end = 7;
					rate_money = 360
				}else if(game_id == 3){
					beg = 5;
					end = 10;
					rate_money = 216;
				}
				var astandrate = new Array();
				var astandmoney = new Array();
				for(var i = start_len,j=0;j<len;i++,j++){
					cbids.push("checkbox_"+i);
					tbids.push("textbox_"+i);
					anum.push(i);
					astandrate.push(parseFloat($('#hiddenField_'+i).parent().prev().html()));
					astandmoney.push(Math.round(rate_money/astandrate[j]));
				}
            var mymoney=0;
            var apreactionnum = new Array();
            apreactionnum.push();
            var apreactionmoney = new Array();
            apreactionmoney.push();
            
            function checkAndSubmit(){
            	if(!$('#modelTable .cb2 input:checked').length){
            		alert('请至少选择一个号码');
            		return false;
            	}
            	$.fn.AUpdateMoney();
            	var details = '['
            	$('#modelTable .cb2 input:checked').each(function(){
            		var detail_num = $(this).attr('id').split('_')[1];
            		var detail_money = $('#textbox_'+$(this).attr('id').split('_')[1]).val();
            		if(!detail_money){
            			alert('请输入号码'+detail_num+'的押注金币数量');
            		}
            		details = details+'{"betNumber":'+detail_num+',"betMoney":'+detail_money+'},'
            	});
            	details = details.slice(0,-1);
            	details = details + ']';
            	$('#total_money').val($('#ActionCountMoney').html().split(',').join(''));
            	$('#detail_json').val(details);
            	$('#save_form').submit();
            }
            
            var serverTime = $('#serverTime').val();
            var endTime = $('#lotteryTime').val();
            var timeIssue2 = $('#period').val(); //期号
            var sec; //还剩秒数
            var timeFlag; //时间倒数对象
            function SetRunTime() {
                $("#timeSec").text(parseInt($("#timeSec").text()) - 1);
                if (parseInt($("#timeSec").text()) == 0) {
                    window.clearInterval(timeFlag);
                    $("#topTime").html('第<font id="timeIssue" class="money">' + timeIssue2 + '</font>期已开奖，请进入下一期投注');
                    
                }
            }
            function DoRunTime() {
                if ($.fn.CompareTime(endTime, serverTime)) {
                    sec = $.fn.GetTimeCSecond(endTime, serverTime);
                    $("#timeSec").text(sec);
                    timeFlag = window.setInterval(SetRunTime, 1000);
                } else {
                    $("#topTime").html('第<font id="timeIssue" class="money">' + timeIssue2 + '</font>期已开奖，请进入下一期投注');
                    
                }
            }
            $(document).ready(function(){
                $("#timeIssue").text(timeIssue2);
                DoRunTime();
            });
            /*]]>*/
</script>
						
						</div>
						<div class="blank"></div>
					</div>
				</div>
			</div>
		</div>
	</div>
</body>
</html>